#include <iostream>
using namespace std;

// 手机
class Phone
{
public:
  string m_pname;

  Phone(string pname)
  {
    m_pname = pname;
    cout << "Phone 构造函数" << endl;
  }

  ~Phone()
  {
    cout << "Phone 析构函数" << endl;
  }
};

class Person
{
public:
  // 姓名
  string m_name;
  // 手机
  Phone m_phone;

  // Phone m_pname = pname; 隐式转换法
  Person(string name, string pname) : m_name(name), m_phone(pname)
  {
    cout << "Person的有参构造" << endl;
  }

  ~Person()
  {
    cout << "Person 析构函数" << endl;
  }
};

// 构造时限构造类对象，再构造自身，析构相反

void test01()
{
  Person p("张三", "苹果MAX");
  cout << p.m_name << "使用：" << p.m_phone.m_pname << endl;
}

int main(int argc, char const *argv[])
{
  test01();

  return 0;
}